{extend name="platform/base" /}
{block name="alert_info"}
<p class="function-prompts">
		<ul>
			<li>当前客服仅适用于以下三种链接</li>
			<li>1.美洽
				<br/>链接地址：<a href="http://www.meiqia.com"  target="_brank">www.meiqia.com</a>
				使用教程：<a href="http://www.niushop.com.cn/document.html?class_id=20&dir_id=63&id=122" target="_blank">http://www.niushop.com.cn/document.html?class_id=20&dir_id=63&id=122</a>
			</li>
			<li>2.KF5
				<br/>链接地址：<a href="http://www.kf5.com" target="_brank">www.kf5.com</a>
				使用教程：<a href="http://www.niushop.com.cn/document.html?class_id=20&dir_id=63&id=123" target="_blank">http://www.niushop.com.cn/document.html?class_id=20&dir_id=63&id=123</a></li>
			<li>3.QQ(qq客服需填写当前客服的qq号码)<br/><br/></li>
		</ul>
	</p>
<style>
</style>
{/block}
{block name="resources"/}
<link rel="stylesheet" type="text/css" href="ADMIN_CSS/defau.css">
<script src="ADMIN_JS/art_dialog.source.js"></script>
<script src="ADMIN_JS/iframe_tools.source.js"></script>
<script src="ADMIN_JS/material_managedialog.js"></script>
<style>
input[type='radio']{
	display:none;
}
.set-style{min-height:400px;}
</style>
{/block}
{block name="main"}
<section class="panel panel-default">
	<header class="panel-heading font-bold"> 客服设置 </header>
	<div class="panel-body">
		<div class="form-horizontal">
		<input type="hidden" id="withdraw_id" value="{$list['id']}">
			<div class="set-style">
				<div class="form-group">
					<label class="col-sm-2 control-label">美洽客服链接：</label>
					<div class="col-md-4">
						<input id="meiqia_service_addr" type="text" value="{$list['value']['meiqia_service_addr']}" class="form-control" />
						<input type="radio" name="service_addr" value="1" {if condition="$list['value']['checked_num'] eq 1"}checked="checked"{/if}/>
						{if condition="$list['value']['checked_num'] eq 1"}
						<td style="text-align: center;line-height:59px;">
							<a href="javascript:;" class="pay-start" status =1 onclick="set_status(this)">
								<img src="ADMIN_IMG/checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
							</a>
						</td>
						{else/}
						<td style="text-align: center;line-height:59px; position: relative; left: 30px; top: 20px;">
							<a href="javascript:;" class="pay-close" status =0 onclick="set_status(this)">
								<img src="ADMIN_IMG/un_checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
							</a>
						</td>
						{/if}	
					</div>
				</div>
			
			
				<div class="form-horizontal">
					<div class="form-group">
						<label class="col-sm-2 control-label">kf5客服链接：</label>
						<div class="col-md-4">
							<input id="kf_service_addr" type="text" value="{$list['value']['kf_service_addr']}" class="form-control" />
							<input type="radio" name="service_addr" value="2" {if condition="$list['value']['checked_num'] eq 2"}checked="checked"{/if}/>
							{if condition="$list['value']['checked_num'] eq 2"}
							<td style="text-align: center;line-height:59px;">
								<a href="javascript:;" class="pay-start" status =1 onclick="set_status(this)">
									<img src="ADMIN_IMG/checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
								</a>
							</td>
							{else/}
							<td style="text-align: center;line-height:59px;">
								<a href="javascript:;" class="pay-close" status =0 onclick="set_status(this)">
									<img src="ADMIN_IMG/un_checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
								</a>
							</td>
							{/if}
						</div>
					</div>
				</div>
				
				<div class="form-horizontal">
					<div class="form-group">
						<label class="col-sm-2 control-label">QQ客服：</label>
						<div class="col-md-4">
							<input id="qq_service_addr" type="text" value="{$list['value']['qq_service_addr']}" class="form-control" />
							<input type="radio" name="service_addr" value="3" {if condition="$list['value']['checked_num'] eq 3"}checked="checked"{/if}/>
							{if condition="$list['value']['checked_num'] eq 3"}
							<td style="text-align: center;line-height:59px;">
								<a href="javascript:;" class="pay-start" status =1 onclick="set_status(this)">
									<img src="ADMIN_IMG/checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
								</a>
							</td>
							{else/}
							<td style="text-align: center;line-height:59px;">
							    <a href="javascript:;" class="pay-close" status =0 onclick="set_status(this)">
									<img src="ADMIN_IMG/un_checked.png" alt="" width="18" style="position: relative;left: 570px;top: -27;bottom: 0px;"/>
								</a>
							</td>
							{/if}	
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="line line-dashed line-lg pull-in"></div>
			<div class="form-group">
				<div class="col-sm-4 col-sm-offset-2">
					<a href="javascript:void(0);" onclick="setMemberwithdrawAjax()" class="btn btn-primary">保存</a>
				</div>
			</div>
	</div>
</section>
<script src="__STATIC__/js/ajax_file_upload.js" type="text/javascript"></script>
<script src="__STATIC__/js/file_upload.js" type="text/javascript"></script>
<script>

function set_status(event){
	$('.set-style').find('img').attr('src', 'ADMIN_IMG/un_checked.png');
	$(event).find('img').attr('src', 'ADMIN_IMG/checked.png');
	$("input[type='radio']").prop('checked',false);
	$(event).parents('.col-md-4').find("input[type='radio']").prop('checked',true);
	
}

function setMemberwithdrawAjax() {
	
	var meiqia_service_addr = $("#meiqia_service_addr").val();
	var kf_service_addr = $("#kf_service_addr").val();
	var qq_service_addr = $("#qq_service_addr").val();
	var checked_num = $("input:radio[name='service_addr']:checked").val();

		$.ajax({
			type : "post",
			url : "{:__URL('PLATFORM_MAIN/config/customservice')}",
			data : {
				'meiqia_service_addr' : meiqia_service_addr,
				'kf_service_addr' : kf_service_addr,
				'qq_service_addr' : qq_service_addr,
				'checked_num':checked_num
			},
			success : function(data) {
				if (data['code'] > 0) {
					showTip('提交成功','success');
				} else {
					showTip('提交失败','error');
				}
			}
		});
	
}
window.onload=function(){
	var is_open = $("#is_open").val();
	if(is_open == ''){
		is_open = 0;
	}
	if(parseInt(is_open) == 0){
		$("#enableNo").prop("checked","checked");
	}else{
		$("#enableYes").prop("checked","checked");
	}
}
</script>
{/block}